<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery.min.js?v=2.1.4"></script>
    <script src="../js/template.engine.js"></script>
    <style>
        *[foreach]{
            display: none;
        }
    </style>
</head>
<body>

    <script>

        var data = {
            master:2,
            base:1,
            array:[
                {name:"name1",age:'1',tu:1,sex:1},
                {name:"name2",age:'2',tu:0,sex:0},
                {name:"name3",age:'3',tu:true,sex:1},
                {name:"name4",age:'4',tu:false,sex:0},
            ]
        };

        var tp = '\
            <h1><value data-variate="master" input-type="select" select-option="[{name:\'template\',value:\'1\'},{name:\'devel\',value:\'2\'}]"></value></h1>\
                <table>\
                        <tr foreach data-variate="array">\
                            <td><value data-variate="name"></value></td>\
                            <td><value data-variate="aa" input-type="number"></value></td>\
                            <td><value data-variate="bb" input-type="number" data-value="5"></value></td>\
                            <td><value data-variate="age" data-formula="aa/bb+base*sex*tu"></value></td>\
                            <td><value data-variate="sex" input-type="select" select-option="[{name:\'男\',value:\'1\'},{name:\'女\',value:\'0\'}]"></value></td>\
                        </tr>\
                </table>\
            </div>\
            ';

//        console.log(template.print(tp,data));
        var tp = templateEngine.parsing(tp,data);
        $('body').append(tp);
        templateEngine.input('body',data);
    </script>
</body>
</html>